﻿<?php
include('config.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" href="images/style.css" type="text/css" />
<title>-</title>
</head>
<body>
<?php
include('config.php');
if($_SERVER['REQUEST_METHOD'] == 'POST') {

    preg_match('/\.([a-zA-Z]+?)$/', $_FILES['file']['name'], $matches);

    if(in_array(strtolower($matches[1]), $accepted)) {

        if($_FILES['file']['size'] <= $maxsize) {

            $newname = md5_file($_FILES['file']['tmp_name']).'.'.$matches[1];

            move_uploaded_file($_FILES['file']['tmp_name'], $filedir.'/'.$newname);

            $linkurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']).'#'.$newname;

            $imgurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']).$filedir.'/'.$newname;
			$alt = $_POST["alt"];

            print '<p id="codes">
            <label for="codebb">BBCode:</label>
            <input type="text" id="codebb" value="[IMG]'.$imgurl.'[/IMG]" onclick="javascript:this.focus();this.select();" readonly="true" /><br />';

        } else 

            print '<p>Sorry, Max Picture size is 10Mb</p>';

    } else

        print '<p>Sorry, Filetype Not Allowed</p>';

}

?>
<form enctype="multipart/form-data" action="<?php print preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']) ?>" method="post">
<label for="file">Picture Upload: </label><input type="file" name="file" id="file" />(Max Pic. Size is 10MB)<br />
<input name="submit" type="submit" value="Upload Picture" class="button"> 
</form>
<?
$page  = $_GET['p'];

if ($page == Null)
{

}
else if ($page == contact)
include("contact.php");
else
{
echo "<center><b><h1>are u tryng to h4x0r or something ? :D</h1></b></center>";
}

?>
</body>
</html>

